home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume18 / undel / part01 next >
Encoding:
Internet Message Format  |  1989-05-06  |  27.6 KB

  1. Path: uunet!bbn.com!rsalz
  2. From: rsalz@uunet.uu.net (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v18i073:  MIT Athena delete/undelete programs, Part01/06
  5. Message-ID: <1633@fig.bbn.com>
  6. Date: 29 Mar 89 04:30:51 GMT
  7. Lines: 876
  8. Approved: rsalz@uunet.UU.NET
  9.  
  10. Submitted-by: Jonathan I. Kamens <jik@PIT-MANAGER.MIT.EDU>
  11. Posting-number: Volume 18, Issue 73
  12. Archive-name: undel/part01
  13.  
  14. [  This will need a bit of work to run under non-BSD.  It's also
  15.    probably going to be the LAST safe-rm/unrm/whatever posting
  16.    I approve, except for patches.  --r$  ]
  17.  
  18. This archives contains the sources for five programs (well, actually,
  19. four, since one is a symbolic link):
  20.     delete
  21.     undelete
  22.     expunge
  23.     purge
  24.     lsdel
  25.  
  26. The programs were written at Project Athena in response to the problem
  27. which many novice Unix users have with accidentally deleting files
  28. they didn't want to delete (Hell, I've done it :-).
  29.  
  30. I am already aware of quite a few improvements I could make in the
  31. code (I am fairly certain that there are better regexp matching
  32. libraries *and* better directory searching libraries I could be
  33. using.), and I will be making them as soon as I am done with my
  34. current project.  I would appreciate hearing any suggestions you may
  35. have and/or accepting any patches you wish to submit :-)
  36.  
  37. #! /bin/sh
  38. # This is a shell archive.  Remove anything before this line, then unpack
  39. # it by saving it into a file and typing "sh file".  To overwrite existing
  40. # files, type "sh file -c".  You can also feed this as standard input via
  41. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  42. # will see the following message at the end:
  43. #        "End of archive 1 (of 6)."
  44. # Contents:  MANIFEST README col.h delete.h directories.h expunge.h
  45. #   lsdel.h man1 man1/expunge.1 man1/lsdel.1 man1/purge.1
  46. #   man1/undelete.1 mit-copyright.h pattern.h undelete.h util.h
  47. # Wrapped by jik@pit-manager on Mon Mar 27 12:16:44 1989
  48. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  49. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  50.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  51. else
  52. echo shar: Extracting \"'MANIFEST'\" \(920 characters\)
  53. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  54. X   File Name        Archive #    Description
  55. X-----------------------------------------------------------
  56. X MANIFEST                   1    This shipping list
  57. X Makefile                   2    
  58. X README                     1    
  59. X col.c                      2    
  60. X col.h                      1    
  61. X delete.c                   3    
  62. X delete.h                   1    
  63. X directories.c              6    
  64. X directories.h              1    
  65. X expunge.c                  4    
  66. X expunge.h                  1    
  67. X lsdel.c                    3    
  68. X lsdel.h                    1    
  69. X man1                       1    
  70. X man1/delete.1              2    
  71. X man1/expunge.1             1    
  72. X man1/lsdel.1               1    
  73. X man1/purge.1               1    
  74. X man1/undelete.1            1    
  75. X mit-copyright.h            1    
  76. X pattern.c                  4    
  77. X pattern.h                  1    
  78. X undelete.c                 5    
  79. X undelete.h                 1    
  80. X util.c                     2    
  81. X util.h                     1    
  82. END_OF_FILE
  83. if test 920 -ne `wc -c <'MANIFEST'`; then
  84.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  85. fi
  86. # end of 'MANIFEST'
  87. fi
  88. if test -f 'README' -a "${1}" != "-c" ; then 
  89.   echo shar: Will not clobber existing file \"'README'\"
  90. else
  91. echo shar: Extracting \"'README'\" \(1463 characters\)
  92. sed "s/^X//" >'README' <<'END_OF_FILE'
  93. XThis archives contains the sources for five programs (well, actually,
  94. Xfour, since one is a symbolic link):
  95. X
  96. X    delete
  97. X    undelete
  98. X    expunge
  99. X    purge
  100. X    lsdel
  101. X
  102. XThe programs were written at Project Athena in response to the problem
  103. Xwhich many novice Unix users have with accidentally deleting files
  104. Xthey didn't want to delete (Hell, I've done it :-).
  105. X
  106. XI am already aware of quite a few improvements I could make in the
  107. Xcode (I am fairly certain that there are better regexp matching
  108. Xlibraries *and* better directory searching libraries I could be
  109. Xusing.), and I will be making them as soon as I am done with my
  110. Xcurrent project.  I would appreciate hearing any suggestions you may
  111. Xhave and/or accepting any patches you wish to submit :-)
  112. X
  113. XI've only compiled these under 4.3BSD on VAXen and IBM RT/PC's, as
  114. Xwell as on Mach on the NeXT Machine, but I assume they should compile
  115. Xwith minimal trouble on other architectures (does SysV have the
  116. Xre_comp and re_exec procedures for regular expression matching?).
  117. X
  118. XIf you make it compile on another platform and you have to make
  119. Xchanges, please send me patches.
  120. X
  121. XMy address:
  122. X
  123. XJonathan Kamens                          USnail:
  124. XMIT Project Athena                410 Memorial Drive, No. 223F
  125. Xjik@Athena.MIT.EDU                Cambridge, MA 02139-4318
  126. XOffice: 617-253-4261                  Home: 617-225-8218
  127. X
  128. XP.S. Please see the file "mit-copyright.h" for copying and
  129. Xredistribution information.  Copyright 1989 Massachusetts Institute of
  130. XTechnology.  All Rights Reserved.  Etc.
  131. END_OF_FILE
  132. if test 1463 -ne `wc -c <'README'`; then
  133.     echo shar: \"'README'\" unpacked with wrong size!
  134. fi
  135. # end of 'README'
  136. fi
  137. if test -f 'col.h' -a "${1}" != "-c" ; then 
  138.   echo shar: Will not clobber existing file \"'col.h'\"
  139. else
  140. echo shar: Extracting \"'col.h'\" \(1485 characters\)
  141. sed "s/^X//" >'col.h' <<'END_OF_FILE'
  142. X/*
  143. X * $Source: /mit/jik/src/delete/RCS/col.h,v $
  144. X * $Author: jik $
  145. X *
  146. X * This header file is part of a package including delete, undelete,
  147. X * lsdel, expunge and purge.  The software suite is meant as a
  148. X * replacement for rm which allows for file recovery.
  149. X * 
  150. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  151. X * For copying and distribution information, see the file "mit-copyright.h."
  152. X */
  153. X#include "mit-copyright.h"
  154. X
  155. X/*
  156. X * DEF_COL_WIDTH: the column with to try to use if none is specified.
  157. X * DEF_WAIT: 1 if the program is supposed to wait for stdin to get to
  158. X *           end-of-file and then print out everything in order in
  159. X *           columns by default.  If this is 0, then the default is
  160. X *           for the program to print across instead of down and to
  161. X *           print as it receives input from stdin.
  162. X * DEF_VAR_COLS: if 1, use variable-width columns based on text width.
  163. X *               if 1, DEF_WAIT must be true.
  164. X * DEF_SCR_WIDTH: default screen width
  165. X * DEF_NUM_ITEMS: if 1, number each item
  166. X * DEF_MARGIN: the default margin in between columns of text
  167. X */ 
  168. X#define DEF_COL_WIDTH 20
  169. X#define DEF_WAIT 1
  170. X#define DEF_VAR_COLS 1
  171. X#define DEF_SCR_WIDTH 80
  172. X#define DEF_NUM_ITEMS 1
  173. X#define DEF_MARGIN 2
  174. X /* This is used for when we need a guess as to how long a number will */
  175. X /* be when printed.  Also, if we are supposed to work in wait mode    */
  176. X /* and are not given a maxitems value, this is what is used.          */
  177. X#define DEF_MAX_ITEMS 10000
  178. END_OF_FILE
  179. if test 1485 -ne `wc -c <'col.h'`; then
  180.     echo shar: \"'col.h'\" unpacked with wrong size!
  181. fi
  182. # end of 'col.h'
  183. fi
  184. if test -f 'delete.h' -a "${1}" != "-c" ; then 
  185.   echo shar: Will not clobber existing file \"'delete.h'\"
  186. else
  187. echo shar: Extracting \"'delete.h'\" \(536 characters\)
  188. sed "s/^X//" >'delete.h' <<'END_OF_FILE'
  189. X/*
  190. X * $Source: /mit/jik/src/delete/RCS/delete.h,v $
  191. X * $Author: jik $
  192. X * $Header: delete.h,v 1.3 89/03/27 12:06:11 jik Exp $
  193. X * 
  194. X * This file is part of a package including delete, undelete,
  195. X * lsdel, expunge and purge.  The software suite is meant as a
  196. X * replacement for rm which allows for file recovery.
  197. X * 
  198. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  199. X * For copying and distribution information, see the file "mit-copyright.h."
  200. X */
  201. X
  202. X#define ERROR_MASK 1
  203. X#define NO_DELETE_MASK 2
  204. X
  205. X#include "mit-copyright.h"
  206. END_OF_FILE
  207. if test 536 -ne `wc -c <'delete.h'`; then
  208.     echo shar: \"'delete.h'\" unpacked with wrong size!
  209. fi
  210. # end of 'delete.h'
  211. fi
  212. if test -f 'directories.h' -a "${1}" != "-c" ; then 
  213.   echo shar: Will not clobber existing file \"'directories.h'\"
  214. else
  215. echo shar: Extracting \"'directories.h'\" \(1434 characters\)
  216. sed "s/^X//" >'directories.h' <<'END_OF_FILE'
  217. X/*
  218. X * $Source: /mit/jik/src/delete/RCS/directories.h,v $
  219. X * $Author: jik $
  220. X * $Header: directories.h,v 1.6 89/03/27 12:06:24 jik Exp $
  221. X * 
  222. X * This file is part of a package including delete, undelete,
  223. X * lsdel, expunge and purge.  The software suite is meant as a
  224. X * replacement for rm which allows for file recovery.
  225. X * 
  226. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  227. X * For copying and distribution information, see the file "mit-copyright.h."
  228. X */
  229. X
  230. X#include "mit-copyright.h"
  231. X
  232. Xtypedef short Boolean;
  233. X#define True            (Boolean) 1
  234. X#define False            (Boolean) 0
  235. X
  236. X
  237. X#define blk_to_k(x)        (x * DEV_BSIZE / 1024)
  238. X
  239. X#define FOLLOW_LINKS        1
  240. X#define DONT_FOLLOW_LINKS    0
  241. X     
  242. Xtypedef struct filrec {
  243. X     char name[MAXNAMLEN];
  244. X     struct filrec *previous;
  245. X     struct filrec *parent;
  246. X     struct filrec *dirs;
  247. X     struct filrec *files;
  248. X     struct filrec *next;
  249. X     Boolean specified;
  250. X     Boolean freed;
  251. X     struct stat specs;
  252. X} filerec;
  253. X
  254. X
  255. X
  256. Xfilerec *add_directory_to_parent();
  257. Xfilerec *add_file_to_parent();
  258. Xfilerec *add_path_to_tree();
  259. Xfilerec *find_child();
  260. Xfilerec *first_in_directory();
  261. Xfilerec *first_specified_in_directory();
  262. Xfilerec *get_cwd_tree();
  263. Xfilerec *get_root_tree();
  264. Xfilerec *next_directory();
  265. Xfilerec *next_in_directory();
  266. Xfilerec *next_leaf();
  267. Xfilerec *next_specified_directory();
  268. Xfilerec *next_specified_in_directory();
  269. Xfilerec *next_specified_leaf();
  270. X
  271. Xchar *get_leaf_path();
  272. Xchar **accumulate_names();
  273. END_OF_FILE
  274. if test 1434 -ne `wc -c <'directories.h'`; then
  275.     echo shar: \"'directories.h'\" unpacked with wrong size!
  276. fi
  277. # end of 'directories.h'
  278. fi
  279. if test -f 'expunge.h' -a "${1}" != "-c" ; then 
  280.   echo shar: Will not clobber existing file \"'expunge.h'\"
  281. else
  282. echo shar: Extracting \"'expunge.h'\" \(591 characters\)
  283. sed "s/^X//" >'expunge.h' <<'END_OF_FILE'
  284. X/*
  285. X * $Source: /mit/jik/src/delete/RCS/expunge.h,v $
  286. X * $Author: jik $
  287. X * $Header: expunge.h,v 1.3 89/03/27 12:06:56 jik Exp $
  288. X * 
  289. X * This file is part of a package including delete, undelete,
  290. X * lsdel, expunge and purge.  The software suite is meant as a
  291. X * replacement for rm which allows for file recovery.
  292. X * 
  293. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  294. X * For copying and distribution information, see the file "mit-copyright.h."
  295. X */
  296. X#include "mit-copyright.h"
  297. X
  298. X#define ERROR_MASK        1
  299. X#define NO_DELETE_MASK        2
  300. X#define NO_TIMEOUT_MASK        4
  301. X
  302. Xchar **get_the_files();
  303. END_OF_FILE
  304. if test 591 -ne `wc -c <'expunge.h'`; then
  305.     echo shar: \"'expunge.h'\" unpacked with wrong size!
  306. fi
  307. # end of 'expunge.h'
  308. fi
  309. if test -f 'lsdel.h' -a "${1}" != "-c" ; then 
  310.   echo shar: Will not clobber existing file \"'lsdel.h'\"
  311. else
  312. echo shar: Extracting \"'lsdel.h'\" \(558 characters\)
  313. sed "s/^X//" >'lsdel.h' <<'END_OF_FILE'
  314. X/*
  315. X * $Source: /mit/jik/src/delete/RCS/lsdel.h,v $
  316. X * $Author: jik $
  317. X * $Header: lsdel.h,v 1.3 89/03/27 12:07:23 jik Exp $
  318. X * 
  319. X * This file is part of a package including delete, undelete,
  320. X * lsdel, expunge and purge.  The software suite is meant as a
  321. X * replacement for rm which allows for file recovery.
  322. X * 
  323. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  324. X * For copying and distribution information, see the file "mit-copyright.h."
  325. X */
  326. X#include "mit-copyright.h"
  327. X
  328. X#define ERROR_MASK 1
  329. X#define NO_DELETE_MASK 2
  330. X
  331. Xchar **get_the_files();
  332. END_OF_FILE
  333. if test 558 -ne `wc -c <'lsdel.h'`; then
  334.     echo shar: \"'lsdel.h'\" unpacked with wrong size!
  335. fi
  336. # end of 'lsdel.h'
  337. fi
  338. if test ! -d 'man1' ; then
  339.     echo shar: Creating directory \"'man1'\"
  340.     mkdir 'man1'
  341. fi
  342. if test -f 'man1/expunge.1' -a "${1}" != "-c" ; then 
  343.   echo shar: Will not clobber existing file \"'man1/expunge.1'\"
  344. else
  345. echo shar: Extracting \"'man1/expunge.1'\" \(3824 characters\)
  346. sed "s/^X//" >'man1/expunge.1' <<'END_OF_FILE'
  347. X.\"    $Source: /mit/jik/src/delete/man1/RCS/expunge.1,v $
  348. X.\"    $Author: jik $
  349. X.\"    $Header: expunge.1,v 1.4 89/03/27 11:32:49 jik Exp $
  350. X.\"
  351. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  352. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  353. X.\" the terms and conditions for redistribution.
  354. X.\"
  355. X.\"
  356. X.TH EXPUNGE 1 "January 27, 1988" "MIT Project Athena"
  357. X.ds ]W MIT Project Athena
  358. X.SH NAME
  359. Xexpunge, purge \- permanent removal of \fIdelete\fR\^d files
  360. X.SH SYNOPSIS
  361. X.B expunge
  362. X[
  363. X.B \-r
  364. X] [
  365. X.B \-i
  366. X] [
  367. X.B \-f
  368. X] [
  369. X.B \-t \fIn\fR
  370. X] [
  371. X.B \-n
  372. X] [
  373. X.B \-v
  374. X] [
  375. X.B \-l
  376. X] [
  377. X.B \-y
  378. X] [
  379. X.B \-\|\-
  380. X] [ filename [ ... ]]
  381. X.PP
  382. X.B purge
  383. X.PP
  384. X.SH DESCRIPTION
  385. X.I Expunge
  386. Xand
  387. X.I purge
  388. Xpermanently remove files which have been marked for deletion using
  389. X\fIdelete\fR(1).  Files removed with \fIexpunge\fR or \fIpurge\fR
  390. Xcannot be recovered, and care should therefore be exercised in the
  391. Xuse of these utilities.
  392. X.PP
  393. X.I Purge
  394. Xis a simple utility which takes no command-line arguments.  When it is
  395. Xexecuted, it searches through the user's entire home directory and
  396. Xfinds all files that have been marked for deletion.  It then displays
  397. Xa list of the files where are to be removed and prompts for
  398. Xconfirmation.  A response from the user starting with the letter
  399. X\fIy\fR will cause the files to be permanently expunged.
  400. X.PP
  401. XBecause
  402. X.I purge
  403. Xsearches through the user's entire home directory, it can take quite a
  404. Xwhile to complete its search.  This is normal.
  405. X.PP
  406. XThe filenames passed to
  407. X.I expunge
  408. Xon the command-line can be directories (deleted or not deleted) or
  409. Xdeleted files.  Deleted files or directories are always completely
  410. Xexpunged, while the treatment of non-deleted directories depends on
  411. Xthe
  412. X.BR \-r
  413. Xcommand-line option (see below).  If no command-line filenames are
  414. Xspecified,
  415. X.I expunge
  416. Xdefaults to the current working directory.
  417. X.PP
  418. XFor information about wildcard use with \fIexpunge\fR, please see
  419. X\fIundelete\fR(1).
  420. X.PP
  421. X.SH OPTIONS
  422. X.I Expunge
  423. Xaccepts the following command-line options:
  424. X.TP
  425. X.B \-r
  426. XWhen a non-deleted directory is passed to \fIexpunge\fR, the 
  427. X.BR \-r
  428. Xoption causes the directory to be searced recursively for deleted
  429. Xfiles.  If the recursive option is \fInot\fR specified, only the
  430. Xdirect children of the non-deleted directory are examined.  A
  431. Xrecursive search of a large directory can take quite a while.
  432. X.TP
  433. X.B \-i
  434. XThe user is prompted for confirmation with the name of the file and
  435. Xits size in kilobytes before each file or directory is
  436. Xrestored.
  437. X.TP
  438. X.B \-f
  439. XUsed in conjunction with the
  440. X.BR \-l
  441. Xoption, this option prevents 
  442. X.I expunge
  443. Xfrom prompting for confirmation after listing all the files that are
  444. Xtoo be deleted.  Furthermore, it prevents the printing of error
  445. Xmessages.
  446. X.TP
  447. X.B \-t\fIn\fR
  448. XSpecifies the minimum age (in days) of files to be expunged, measured
  449. Xas the length of time since the last file modification.
  450. X.TP
  451. X.B \-n
  452. XNo file expunges are performed.  Instead,
  453. X.I expunge
  454. Xprints to the standard output the files that it would expunge were the
  455. X.BR \-n
  456. Xoption not specified.
  457. X.TP
  458. X.B \-v
  459. XCauses 
  460. X.I expunge
  461. Xto report each file as it is expunged, as well as the size of the file
  462. Xand a running total of the number of kilobytes expunged.
  463. X.TP
  464. X.B \-l
  465. XCauses 
  466. X.I expunge
  467. Xto list all found files before expunging them, similar to the actions
  468. Xof
  469. X.I purge.
  470. X.TP
  471. X.B \-y
  472. XThe total number of kilobytes expunged is printed after
  473. X.I expunge
  474. Xis finished removing files.
  475. X.TP
  476. X.B \-\|\-
  477. XTwo dashes indicate that all arguments following it are to be treated
  478. Xas file names, even if they start with a dash.
  479. X.SH "SEE ALSO"
  480. Xdelete(1), undelete(1), lsdel(1), rm(1), rmdir(1)
  481. X.SH AUTHOR
  482. XJonathan I. Kamens (MIT-Project Athena)
  483. X.SH RESTRICTIONS
  484. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  485. Xrights reserved.
  486. X.IR Delete (1)
  487. Xspecifies the terms and conditions for redistribution.
  488. END_OF_FILE
  489. if test 3824 -ne `wc -c <'man1/expunge.1'`; then
  490.     echo shar: \"'man1/expunge.1'\" unpacked with wrong size!
  491. fi
  492. # end of 'man1/expunge.1'
  493. fi
  494. if test -f 'man1/lsdel.1' -a "${1}" != "-c" ; then 
  495.   echo shar: Will not clobber existing file \"'man1/lsdel.1'\"
  496. else
  497. echo shar: Extracting \"'man1/lsdel.1'\" \(1902 characters\)
  498. sed "s/^X//" >'man1/lsdel.1' <<'END_OF_FILE'
  499. X.\"    $Source: /mit/jik/src/delete/man1/RCS/lsdel.1,v $
  500. X.\"    $Author: jik $
  501. X.\"    $Header: lsdel.1,v 1.3 89/03/27 11:32:45 jik Exp $
  502. X.\"
  503. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  504. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  505. X.\" the terms and conditions for redistribution.
  506. X.\"
  507. X.\"
  508. X.TH LSDEL 1 "January 27, 1988" "MIT Project Athena"
  509. X.ds ]W MIT Project Athena
  510. X.SH NAME
  511. Xlsdel \- list deleted files
  512. X.SH SYNOPSIS
  513. X.B lsdel
  514. X[
  515. X.B \-d
  516. X] [
  517. X.B \-r
  518. X] [
  519. X.B \-t \fIn\fR
  520. X] [
  521. X.B \-y
  522. X] [ filename [ ... ]]
  523. X.PP
  524. X.SH DESCRIPTION
  525. X.I Lsdel
  526. Xlists files that have been marked for deletion by the \fIdelete\fR(1)
  527. Xprogram.
  528. X.PP
  529. XFor information about using wildcards with \fIlsdel\fR, see
  530. X\fIundelete\fR(1).
  531. X.PP
  532. XFilenames passed to \fIlsdel\fR can be directories (non-deleted or
  533. Xdeleted) or deleted files.  If a non-deleted directory is specified,
  534. Xlsdel lists the deleted contents of that directory.  If the
  535. X.BR \-r
  536. Xoption is specified, all non-deleted children of the directory will be
  537. Xsearched recursively for deleted files.  If not command-line filenames
  538. Xare specified,
  539. X.I lsdel
  540. Xdefaults to the current working directory.
  541. X.PP
  542. X.I Lsdel
  543. Xrecursively lists deleted directories by default.  This can be
  544. Xdisabled with the
  545. X.BR \-d
  546. Xoption, which causes directory names, rather than their contents, to
  547. Xbe listed.
  548. X.PP
  549. XThe
  550. X.BR \-t
  551. Xoption allows the user to specify a minimum age, in days, of files to
  552. Xlist.  Only files that have not been modified in \fIn\fR days or more
  553. Xwill be listed.
  554. X.PP
  555. XThe
  556. X.BR \-y
  557. Xoption causes
  558. X.I lsdel
  559. Xto print the total amount of space taken up by all the files it lists.
  560. X.SH "SEE ALSO"
  561. Xdelete(1), undelete(1), purge(1), expunge(1), ls(1)
  562. X.SH AUTHOR
  563. XJonathan I. Kamens (MIT-Project Athena)
  564. X.SH RESTRICTIONS
  565. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  566. Xrights reserved.
  567. X.IR Delete (1)
  568. Xspecifies the terms and conditions for redistribution.
  569. END_OF_FILE
  570. if test 1902 -ne `wc -c <'man1/lsdel.1'`; then
  571.     echo shar: \"'man1/lsdel.1'\" unpacked with wrong size!
  572. fi
  573. # end of 'man1/lsdel.1'
  574. fi
  575. if test -f 'man1/purge.1' -a "${1}" != "-c" ; then 
  576.   echo shar: Will not clobber existing file \"'man1/purge.1'\"
  577. else
  578. echo shar: Extracting \"'man1/purge.1'\" \(348 characters\)
  579. sed "s/^X//" >'man1/purge.1' <<'END_OF_FILE'
  580. X.\"    $Source: /mit/jik/src/delete/man1/RCS/purge.1,v $
  581. X.\"    $Author: jik $
  582. X.\"    $Header: purge.1,v 1.1 89/01/27 04:50:13 jik Exp $
  583. X.\"
  584. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  585. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  586. X.\" the terms and conditions for redistribution.
  587. X.\"
  588. X.\"
  589. X.so man1/expunge.1
  590. END_OF_FILE
  591. if test 348 -ne `wc -c <'man1/purge.1'`; then
  592.     echo shar: \"'man1/purge.1'\" unpacked with wrong size!
  593. fi
  594. # end of 'man1/purge.1'
  595. fi
  596. if test -f 'man1/undelete.1' -a "${1}" != "-c" ; then 
  597.   echo shar: Will not clobber existing file \"'man1/undelete.1'\"
  598. else
  599. echo shar: Extracting \"'man1/undelete.1'\" \(3506 characters\)
  600. sed "s/^X//" >'man1/undelete.1' <<'END_OF_FILE'
  601. X.\"    $Source: /mit/jik/src/delete/man1/RCS/undelete.1,v $
  602. X.\"    $Author: jik $
  603. X.\"    $Header: undelete.1,v 1.3 89/03/27 11:32:32 jik Exp $
  604. X.\" Copyright 1989 by the Massachusetts Institute of Technology.  All
  605. X.\" rights reserved.  The file /usr/include/mit-copyright.h specifies
  606. X.\" the terms and conditions for redistribution.
  607. X.\"
  608. X.\"
  609. X.TH UNDELETE 1 "January 26, 1988" "MIT Project Athena"
  610. X.ds ]W MIT Project Athena
  611. X.SH NAME
  612. Xundelete \- recover files removed by delete
  613. X.SH SYNOPSIS
  614. X.B undelete
  615. X[
  616. X.B \-r
  617. X] [
  618. X.B \-i
  619. X] [
  620. X.B \-f
  621. X] [
  622. X.B \-v
  623. X] [
  624. X.B \-n
  625. X] [
  626. X.B \-R
  627. X] [
  628. X.B \-\|\-
  629. X] [ filename [ ... ]]
  630. X.PP
  631. X.DESCRIPTION
  632. X.I Undelete
  633. Xrecovers files and directories that have been marked for permanent removal by 
  634. X\fIdelete\fR(1), but have not
  635. Xyet been removed.
  636. X.PP
  637. XFilenames passed to
  638. X.I undelete
  639. Xcan be directories or deleted files.
  640. XIf a directory that is not deleted is passed to
  641. X.I undelete,
  642. Xthen the deleted files or directories in it will be restored; if the
  643. Xrecursive option is specified, then all deleted files or directories
  644. Xin any of its children will be restored as well.
  645. X.PP
  646. XThe shell wildcards \fI*\fR and \fI?\fR are interpreted correctly by
  647. X.I undelete.
  648. XIt is possible to pass wildcards to the program without the wildcards
  649. Xbeing intercepted by the shell by setting
  650. X.I noglob
  651. X(in \fIcsh\fR) or by quoting the wildcards.  To delete a file that
  652. Xactually has a wildcard in its name, you must precede the quoted
  653. Xwildcard with a quoted backslash.
  654. X.PP
  655. XIf no files are specified on the command line,
  656. X.I undelete
  657. Xgoes into interactive mode.  In interactive mode, the user is prompted
  658. Xto enter files to be restored, one file per line.  Typing a carriage
  659. Xreturn on an empty prompt line exits the program.
  660. X.PP
  661. XWildcards and quoting backslashes can be entered directly at the
  662. Xprompt without any shell interference (which is the
  663. Xmain reason there is an interactive mode).
  664. X.SH OPTIONS
  665. X.I Undelete
  666. Xaccepts the following command-line options:
  667. X.TP
  668. X.B \-r
  669. XIf a specified file is a directory, the directory and all of its
  670. Xchildren are restored recursively.  If a specified file is a symbolic
  671. Xlink to a directory, then the directory and its contents will be
  672. Xrestored, not the symbolic link.
  673. X.TP
  674. X.B \-i
  675. XThe user is prompted for confirmation before each file or directory is
  676. Xrestored.  This is not the same as the interactive file name entry
  677. Xmode which is automatically activated when no files are specified on
  678. Xthe command line.
  679. X.TP
  680. X.B \-f
  681. XPrevents
  682. X.I undelete
  683. Xfrom reporting errors.  Further, if an intact (undeleted) version of a
  684. Xfile which is requested for undeletion exists, then
  685. X.I undelete
  686. Xwill not prompt for confirmation before overwriting the undeleted file
  687. Xwith the recovered one.
  688. X.TP
  689. X.B \-v
  690. XCauses
  691. X.I undelete
  692. Xto report each file as it is restored.  Also, causes an introductory
  693. Xmessage to be printed when entering interactive mode.
  694. X.TP
  695. X.B \-n
  696. XNo file recoveries are performed.  Instead,
  697. X.I undelete
  698. Xprints to the standard output the files that it would recover were the
  699. X.B \-n
  700. Xoption not specified.
  701. X.TP
  702. X.B \-R
  703. XPrevents
  704. X.I undelete
  705. Xfrom restoring the contents of directories in any case.
  706. X.TP
  707. X.B \-\|\-
  708. XTwo dashes indicate that all arguments following it are to be treated as file
  709. Xnames, even if they start with a dash.
  710. X.SH "SEE ALSO"
  711. Xdelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
  712. X.SH AUTHOR
  713. XJonathan I. Kamens (MIT-Project Athena)
  714. X.SH RESTRICTIONS
  715. XCopyright (c) 1989 by the Massachusetts Institute of Technology.  All
  716. Xrights reserved.
  717. X.IR Delete (1)
  718. Xspecifies the terms and conditions for redistribution.
  719. END_OF_FILE
  720. if test 3506 -ne `wc -c <'man1/undelete.1'`; then
  721.     echo shar: \"'man1/undelete.1'\" unpacked with wrong size!
  722. fi
  723. # end of 'man1/undelete.1'
  724. fi
  725. if test -f 'mit-copyright.h' -a "${1}" != "-c" ; then 
  726.   echo shar: Will not clobber existing file \"'mit-copyright.h'\"
  727. else
  728. echo shar: Extracting \"'mit-copyright.h'\" \(1025 characters\)
  729. sed "s/^X//" >'mit-copyright.h' <<'END_OF_FILE'
  730. X/*
  731. X
  732. XCopyright 1987,1988 by the Massachusetts Institute of Technology
  733. X
  734. XAll rights reserved.
  735. X
  736. XPermission to use, copy, modify, and distribute this software and its
  737. Xdocumentation for any purpose and without fee is hereby granted,
  738. Xprovided that the above copyright notice appear in all copies and that
  739. Xboth that copyright notice and this permission notice appear in
  740. Xsupporting documentation, and that the name of the Massachusetts
  741. XInstitute of Technology (M.I.T.) not be used in advertising or publicity
  742. Xpertaining to distribution of the software without specific, written
  743. Xprior permission.
  744. X
  745. XM.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  746. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  747. XM.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  748. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  749. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  750. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  751. XSOFTWARE.
  752. X
  753. X*/
  754. END_OF_FILE
  755. if test 1025 -ne `wc -c <'mit-copyright.h'`; then
  756.     echo shar: \"'mit-copyright.h'\" unpacked with wrong size!
  757. fi
  758. # end of 'mit-copyright.h'
  759. fi
  760. if test -f 'pattern.h' -a "${1}" != "-c" ; then 
  761.   echo shar: Will not clobber existing file \"'pattern.h'\"
  762. else
  763. echo shar: Extracting \"'pattern.h'\" \(741 characters\)
  764. sed "s/^X//" >'pattern.h' <<'END_OF_FILE'
  765. X/*
  766. X * $Source: /mit/jik/src/delete/RCS/pattern.h,v $
  767. X * $Author: jik $
  768. X * $Header: pattern.h,v 1.3 89/03/27 12:07:57 jik Exp $
  769. X * 
  770. X * This program is part of a package including delete, undelete,
  771. X * lsdel, expunge and purge.  The software suite is meant as a
  772. X * replacement for rm which allows for file recovery.
  773. X * 
  774. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  775. X * For copying and distribution information, see the file "mit-copyright.h."
  776. X */
  777. X#include "mit-copyright.h"
  778. X
  779. Xchar **add_str();
  780. Xchar **find_contents();
  781. Xchar **find_deleted_contents();
  782. Xchar **find_deleted_contents_recurs();
  783. Xchar **find_matches();
  784. Xchar **find_deleted_matches();
  785. Xchar **find_recurses();
  786. Xchar **find_deleted_recurses();
  787. X
  788. Xchar *parse_pattern();
  789. END_OF_FILE
  790. if test 741 -ne `wc -c <'pattern.h'`; then
  791.     echo shar: \"'pattern.h'\" unpacked with wrong size!
  792. fi
  793. # end of 'pattern.h'
  794. fi
  795. if test -f 'undelete.h' -a "${1}" != "-c" ; then 
  796.   echo shar: Will not clobber existing file \"'undelete.h'\"
  797. else
  798. echo shar: Extracting \"'undelete.h'\" \(739 characters\)
  799. sed "s/^X//" >'undelete.h' <<'END_OF_FILE'
  800. X/*
  801. X * $Source: /mit/jik/src/delete/RCS/undelete.h,v $
  802. X * $Author: jik $
  803. X * $Header: undelete.h,v 1.3 89/03/27 12:08:17 jik Exp $
  804. X * 
  805. X * This program is part of a package including delete, undelete,
  806. X * lsdel, expunge and purge.  The software suite is meant as a
  807. X * replacement for rm which allows for file recovery.
  808. X * 
  809. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  810. X * For copying and distribution information, see the file "mit-copyright.h."
  811. X */
  812. X#include "mit-copyright.h"
  813. X
  814. X#define DELETEPREFIX ".#"
  815. X#define DELETEREPREFIX "\\.#"
  816. X#define ERROR_MASK 1
  817. X#define NO_DELETE_MASK 2
  818. X
  819. Xtypedef struct {
  820. X     char *user_name;
  821. X     char *real_name;
  822. X} listrec;
  823. X
  824. Xlistrec *sort_files();
  825. Xlistrec *unique();
  826. X
  827. Xchar **get_the_files();
  828. END_OF_FILE
  829. if test 739 -ne `wc -c <'undelete.h'`; then
  830.     echo shar: \"'undelete.h'\" unpacked with wrong size!
  831. fi
  832. # end of 'undelete.h'
  833. fi
  834. if test -f 'util.h' -a "${1}" != "-c" ; then 
  835.   echo shar: Will not clobber existing file \"'util.h'\"
  836. else
  837. echo shar: Extracting \"'util.h'\" \(628 characters\)
  838. sed "s/^X//" >'util.h' <<'END_OF_FILE'
  839. X/*
  840. X * $Source: /mit/jik/src/delete/RCS/util.h,v $
  841. X * $Author: jik $
  842. X * $Header: util.h,v 1.4 89/03/27 12:08:41 jik Exp $
  843. X * 
  844. X * This file is part of a package including delete, undelete,
  845. X * lsdel, expunge and purge.  The software suite is meant as a
  846. X * replacement for rm which allows for file recovery.
  847. X * 
  848. X * Copyright (c) 1989 by the Massachusetts Institute of Technology.
  849. X * For copying and distribution information, see the file "mit-copyright.h."
  850. X */
  851. X#include "mit-copyright.h"
  852. X
  853. Xchar *append();
  854. Xchar *convert_to_user_name();
  855. Xchar *firstpart();
  856. Xchar *lastpart();
  857. Xchar *reg_firstpart();
  858. Xchar *strindex();
  859. Xchar *strrindex();
  860. END_OF_FILE
  861. if test 628 -ne `wc -c <'util.h'`; then
  862.     echo shar: \"'util.h'\" unpacked with wrong size!
  863. fi
  864. # end of 'util.h'
  865. fi
  866. echo shar: End of archive 1 \(of 6\).
  867. cp /dev/null ark1isdone
  868. MISSING=""
  869. for I in 1 2 3 4 5 6 ; do
  870.     if test ! -f ark${I}isdone ; then
  871.     MISSING="${MISSING} ${I}"
  872.     fi
  873. done
  874. if test "${MISSING}" = "" ; then
  875.     echo You have unpacked all 6 archives.
  876.     rm -f ark[1-9]isdone
  877. else
  878.     echo You still need to unpack the following archives:
  879.     echo "        " ${MISSING}
  880. fi
  881. ##  End of shell archive.
  882. exit 0
  883.  
  884. -- 
  885. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  886.  
  887.  
  888.